package com.ncbee.base.config.shiro.util;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author fengzirong
 * @DESC  判断请求是否为ajax请求
 * @Date 2019/1/2 20:42
 **/
public class ShiroFilterUtils{
    /**
     *
     * @Author fengzirong
     * @DESC
     * @Date 2019/1/2 20:42
     */
    public static boolean isAjax(ServletRequest request){
        String header = ((HttpServletRequest) request).getHeader("X-Requested-With");
        if("XMLHttpRequest".equalsIgnoreCase(header)){
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }
}